<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="../inc/conn.asp"-->
<!--#include file="../inc/md5.asp"-->
<!--#include file="../common/admin.asp"-->
<%
id=checkstr(inHTML(request("id")))
if id="" then
response.Write("<script>window.location.href='/';</script>")
response.End()
else 
set rs=server.CreateObject("adodb.recordset")
sql="select * from [user] where uid='"&id&"'"
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.Write("<script>window.location.href='/';</script>")
response.End
else
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>add</title>
<link href="../css/style.css" rel="stylesheet" type="text/css"/>
<style>body {background-color: #eaece1;}</style>
</head>

<body>
<div class="main">
  <div class="main-title">会员添加</div>
  <div class="main-content">
  <table width="100%" border="0" cellspacing="1" cellpadding="3" class="tab">
  <tr>
    <td width="10%" bgcolor="#FFFFFF"><strong>id</strong></td>
    <td width="90%" bgcolor="#FFFFFF"><%=rs("id")%></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF"><strong>uid</strong></td>
    <td bgcolor="#FFFFFF"><%=rs("Uid")%></td>
  </tr>
 
  <tr>
    <td bgcolor="#FFFFFF"><strong>类型</strong></td>
    <td bgcolor="#FFFFFF">
	<%
	select case rs("typeid")
	case 1: response.write("大陆")
	case 2: response.write("海外")
	end select
	%>
	</td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF"><strong>级别</strong></td>
    <td bgcolor="#FFFFFF">
    <%
    set rss=conn.execute("select title from usertype where id="&rs("GradeID"))
    if not rss.eof then
    response.write rss("title")
    end if
    set rss=nothing
    %>
    </td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF"><strong>邮箱</strong></td>
    <td bgcolor="#FFFFFF"><%=rs("Mail")%></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF"><strong>用户名</strong></td>
    <td bgcolor="#FFFFFF"><%=rs("username")%></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF"><strong>姓名</strong></td>
    <td bgcolor="#FFFFFF"><%=rs("Name")%></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF"><strong>性别</strong></td>
    <td bgcolor="#FFFFFF"><%=rs("Sex")%></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF"><strong>生日</strong></td>
    <td bgcolor="#FFFFFF"><%=rs("Birth")%></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF"><strong>手机</strong></td>
    <td bgcolor="#FFFFFF"><%=rs("Mobile")%></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF"><strong>QQ</strong></td>
    <td bgcolor="#FFFFFF"><%=rs("Qq")%></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF"><strong>旺旺</strong></td>
    <td bgcolor="#FFFFFF"><%=rs("Wangwang")%></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF"><strong>服务</strong></td>
    <td bgcolor="#FFFFFF">
    <input type="checkbox" <%if rs("Yservice")=true then response.Write " checked"%> disabled/>YAHOO代拍　
    <input type="checkbox" <%if rs("AService")=true then response.Write " checked"%> disabled/>日本代购　
    <input type="checkbox" <%if rs("Tservice")=true then response.Write " checked"%> disabled/>日本转运
    
    </td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF"><strong>关键字1</strong></td>
    <td bgcolor="#FFFFFF"><%=rs("key")%></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF"><strong>关键字2</strong></td>
    <td bgcolor="#FFFFFF"><%=rs("key2")%></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF"><strong>关键字3</strong></td>
    <td bgcolor="#FFFFFF"><%=rs("key3")%></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF"><strong>状态</strong></td>
    <td bgcolor="#FFFFFF"><%=rs("Mark")%></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF"><strong>账户余额</strong></td>
    <td bgcolor="#FFFFFF"><%=rs("Money")%></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF"><strong>信用保证金</strong></td>
    <td bgcolor="#FFFFFF"><%=rs("CreditMargin")%></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF"><strong>积分</strong></td>
    <td bgcolor="#FFFFFF"><%=rs("Point")%></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF"><strong>消费总额</strong></td>
    <td bgcolor="#FFFFFF"><%=rs("Totalspending")%></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF"><strong>注册时间</strong></td>
    <td bgcolor="#FFFFFF"><%=rs("Addtime")%></td>
  </tr>
  
  <form action="" method="post">
  <tr>
    <td bgcolor="#FFFFFF"><strong>等级</strong></td>
    <td bgcolor="#FFFFFF"><select name="usertype">
      <%
					  set rsm=server.CreateObject("adodb.recordset")
					  sql="select * from usertype"
					  rsm.open sql,conn,1,3
					  if not rsm.eof then
					  do while not rsm.eof
					  %>
      <option value="<%=rsm("id")%>"<%if rs("GradeID")=rsm("id") then response.Write " selected"%>><%=rsm("title")%></option>
      <%
					  rsm.movenext
					  loop
					  rsm.close
					  set rsm=nothing
					  end if		 
					  %>
      </select></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF">&nbsp;</td>
    <td bgcolor="#FFFFFF"><input type="submit" name="button" id="button" value="会员等级保存" /></td>
  </tr>
  </form>
  <tr>
    <td bgcolor="#FFFFFF">&nbsp;</td>
    <td bgcolor="#FFFFFF">&nbsp;</td>
  </tr>
     <form action="" method="post">
  <tr>
    <td colspan="2"><strong>增减余额</strong></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF">类型</td>
    <td bgcolor="#FFFFFF"><select name="Typeid">
      <option value="0">充值</option>
      <option value="1">消费</option>
      <option value="2">提现</option>
      <option value="3">退款</option>
      </select></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF">金额</td>
    <td bgcolor="#FFFFFF"><input name="money" type="text" class="input" id="money" style="width:50PX" value="<%=request.QueryString("money")%>" />
      RMB</td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF">&nbsp;</td>
    <td bgcolor="#FFFFFF"><input type="submit" name="button" id="button" value="确定" /></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF">&nbsp;</td>
    <td bgcolor="#FFFFFF">&nbsp;</td>
    </tr>
    </form>
  <tr>
    <td bgcolor="#FFFFFF">&nbsp;</td>
    <td bgcolor="#FFFFFF">&nbsp;</td>
  </tr>
    <tr>
      <td bgcolor="#FFFFFF">&nbsp;</td>
      <td bgcolor="#FFFFFF">&nbsp;</td>
    </tr>
     <form action="" method="post">
  <tr>
    <td colspan="2"><strong>信用保证金增减余额</strong></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF">金额</td>
    <td bgcolor="#FFFFFF"><input name="money" type="text" class="input" id="money" style="width:50PX" value="<%=request.QueryString("money")%>" />
      RMB</td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF">&nbsp;</td>
    <td bgcolor="#FFFFFF"><input name="Change" type="radio" id="radio3" value="1" />
增加
  <input type="radio" name="Change" id="radio4" value="0" />
减少</td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF">&nbsp;</td>
    <td bgcolor="#FFFFFF"><input type="submit" name="button" id="button" value="信用保证金确定更改" /></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF">&nbsp;</td>
    <td bgcolor="#FFFFFF">&nbsp;</td>
    </tr>
    </form>
  <tr>
    <td bgcolor="#FFFFFF">&nbsp;</td>
    <td bgcolor="#FFFFFF">&nbsp;</td>
    </tr>
    </form>
  </table>
</div>
</div>
</body>
</html>
<%
if request.Form("button")="信用保证金确定更改" then

		money=request.Form("money")
		Change=request.Form("Change")
  
		if money="" or Change="" then
		response.write"<script>alert('不能为空');</script>"
		response.write"<script>window.history.back(-1);</script>"
		response.end
		end if
		
		select case Change
		case 0: Balance=cdbl(rs("money"))+cdbl(money) : sqlmoney="money+"&cdbl(money)&"" : sqlCreditMargin="CreditMargin-"&cdbl(money)&"" : SymbolMoney="+"
		case 1: Balance=cdbl(rs("money"))-cdbl(money) : sqlmoney="money-"&cdbl(money)&"" : sqlCreditMargin="CreditMargin+"&cdbl(money)&"" : SymbolMoney="-"
		end select

        set rsx=server.createobject("adodb.recordset")
		sql="select * from funds" 
		rsx.open sql,conn,1,3
		rsx.addnew  
		rsx("Uid")=rs("uid")
		rsx("money")=SymbolMoney&money
		rsx("Balance")=Balance
		rsx("content")=request.cookies("admin")("name")&"操作"
		rsx("Type")=4
		rsx("PayType")=2
		rsx("mark")=1
		rsx.update
		rsx.close
		set rsx=nothing
		
		conn.execute("update [user] set money="&sqlmoney&" where id ="&rs("id")&"")
		conn.execute("update [user] set CreditMargin="&sqlCreditMargin&" where id ="&rs("id")&"")
		
	  response.write"<script language=JavaScript>{window.alert('信用保证金增减成功！');window.location.href='edit.asp?id="&rs("uid")&"';}</script>"
end if






if request.Form("button")="会员等级保存" then

		usertype=request.Form("usertype")

        set rsx=server.createobject("adodb.recordset")
		sql="select * from [user] where uid='"&rs("uid")&"'" 
		rsx.open sql,conn,1,3
		rsx("GradeID")=usertype
		rsx.update
		rsx.close
		set rsx=nothing
	    response.write"<script language=JavaScript>{window.alert('保存成功！');window.location.href='edit.asp?id="&rs("uid")&"';}</script>"
end if






if request.Form("button")="确定" then

		money=request.Form("money")
		Typeid=request.Form("Typeid")
  
		if money="" or Typeid="" then
		response.write"<script>alert('不能为空');</script>"
		response.write"<script>window.history.back(-1);</script>"
		response.end
		end if

		select case Typeid
		case 0: Balance=cdbl(rs("money"))+cdbl(money) : sqlmoney="money+"&cdbl(money)&"" : SymbolMoney="+"
		case 1: Balance=cdbl(rs("money"))-cdbl(money) : sqlmoney="money-"&cdbl(money)&"" : SymbolMoney="-"
		case 2: Balance=cdbl(rs("money"))-cdbl(money) : sqlmoney="money-"&cdbl(money)&"" : SymbolMoney="-"
		case 3: Balance=cdbl(rs("money"))+cdbl(money) : sqlmoney="money+"&cdbl(money)&"" : SymbolMoney="+"
		end select

        set rsx=server.createobject("adodb.recordset")
		sql="select * from funds" 
		rsx.open sql,conn,1,3
		rsx.addnew  
		rsx("Uid")=rs("uid")
		rsx("money")=SymbolMoney&money
		rsx("Balance")=Balance
		rsx("content")=request.cookies("admin")("name")&"操作"
		rsx("Type")=typeid
		rsx("PayType")=2
		rsx("mark")=1
		rsx.update
		rsx.close
		set rsx=nothing
		
		conn.execute("update [user] set money="&sqlmoney&" where id ="&rs("id")&"")
		
	  response.write"<script language=JavaScript>{window.alert('资金增减成功！');window.location.href='edit.asp?id="&rs("uid")&"';}</script>"
end if




end if
rs.close
set rs=nothing
end if
%>